package com.pet.system.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pet.system.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    @Select("SELECT submit_time as date ,count(*) AS num from (\n" +
            "SELECT DATE_FORMAT(submit_time,'%Y-%m-%d') AS submit_time \n" +
            "FROM service_order where date_sub(curdate(), interval 7 day) <= submit_time)t\n" +
            "GROUP BY submit_time")
    List<Map<String, Integer>> orderNum();

    @Select("SELECT staff_id as name ,count(*) AS num from service_order where staff_id is not null GROUP BY staff_id")
    List<Map<String, Integer>> staffOrder();
}
